package com.iwhalecloud.citybrain.flow.platform.manager.domain.model.monitor;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iwhalecloud.citybrain.flow.platform.manager.domain.model.log.FlowCommonOperateLogVo;
import lombok.Data;
import org.springframework.beans.BeanUtils;

/**
 * @author lilh
 * @date 2019-08-16 13:52
 */
@Data
public class TaskLogVo implements Serializable {
    private static final long serialVersionUID = 9089920064980147139L;

    /**
     * 任务id
     */
    private String taskId;

    /**
     * 任务名称
     */
    private String taskName;

    /**
     * 节点编码
     */
    private String activityId;

    /**
     * 待办人
     */
    private List<String> candidateUsers = new ArrayList<>();

    @JsonProperty("arriveTime")
    private Date createTime;

    /**
     * 处理时限
     */
    private String processLimitDuration;

    /**
     * 状态
     */
    private String status;

    /**
     * 环节状态
     */
    private String linkStatus;

    /**
     * 办理项
     */
    private List<AssigneeItem> assigneeItems = new ArrayList<>();

    private List<FlowCommonOperateLogVo> logs = new ArrayList<>();

    public TaskLogVo() {
    }

    public TaskLogVo(FlowTaskTraceVo flowTaskTrace) {
        BeanUtils.copyProperties(flowTaskTrace, this);
    }



    @Data
    public static class AssigneeItem {

        /**
         * 处理人
         */
        private String assignee;

        /**
         * 处理时间
         */
        private Date completeTime;

        /**
         * 状态：正常、预警、超期、终止、暂停、撤办、错误
         */
        private String status;

        /**
         * 环节状态：待处理、已处理
         */
        private String linkStatus;

        /**
         * 类别
         */
        private String category;

        /**
         * 审批结果
         */
        private String approval;

    }

}
